/*
 * Created by Asnull.
 * Website:https://lipux.cn/
 * Date:2023-1-29
 */

// 依赖模块
const config = require('../config');
const mysql = require('mysql');

// 连接到数据库
const database = mysql.createPool(config.mysql);

// 获取我的文件列表
module.exports.myFileList = (req,res)=>{
    let userId = req.body.user;
    let sql = 'select * from file where user=? order by id desc';
    database.query(sql,[userId],(err,result)=>{
        if (err) return res.send({
            code:400,
            msg:'找不到数据库啦！' + err.message
        })
        res.send({
            code:200,
            allFileSize:config.allFileSize,
            allowMimetype:config.allowMimetype,
            data:result
        })
    })

}
